package cn.sunlelin.educationserver.controller;

import cn.sunlelin.educationserver.entity.Identitytype;
import cn.sunlelin.educationserver.service.IdentitytypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin
public class IdentitytypeController {
    @Autowired
    private IdentitytypeService identitytypeService;

    @GetMapping("/identitytype/selectIdentitytypeById/{identitytypeId}")
    public Map<String,Object> selectIdentitytypeById(@PathVariable Integer identitytypeId){
        Identitytype identitytype=identitytypeService.selectIdentitytypeById(identitytypeId);
        Map<String,Object> map=new HashMap<>();
        if(identitytype!=null){
            map.put("code",200);
            map.put("msg","根据Id查找身份类型成功");
            map.put("dataobject",identitytype);
        }
        else {
            map.put("code",500);
            map.put("msg","根据Id查找身份类型失败");
            map.put("dataobject",null);
        }
        return map;
    }
}
